package cn.itcast.dmp.tags
import org.apache.commons.lang3.StringUtils
import org.apache.spark.sql.Row

object Tags4AreaMaker extends TagsMaker {
  override def make(row: Row, dic: Map[String, String]): Map[String, Double] = {
    // 获取商圈信息
    val areaValue = row.getAs[String]("area")
    if(!"None".equals(areaValue)){
      areaValue.trim
        .split(":")
        .filter(area => StringUtils.isNotBlank(area))
        .map(area =>s"BA$area" -> 1.0)
        .toMap
    }else{
      Map[String,Double]()
    }
  }
}
